package com.zlzxm.shoesmarket.view.activity;

import android.content.Context;
import android.content.Intent;

import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.zlzxm.shoesmarket.R;
import com.zlzxm.shoesmarket.util.ZViewHelp;
import com.zlzxm.shoesmarket.view.adapter.ADBuySaleAllInfo;
import com.zlzxm.shoesmarket.view.widget.simpleead.SimpleHead;
import com.zlzxm.shoesmarket.viewmodel.VMBuySaleAll;

/**
 * CREATE BY zlzxm ON 4/14/21
 * <br/>进销存汇总
 */
public class ACBugSaleAll extends BaseActivity {


    public static void start(Context context) {
        Intent starter = new Intent(context, ACBugSaleAll.class);
        context.startActivity(starter);
    }

    private VMBuySaleAll vmBuySaleAll;

    private RecyclerView recyclerView;

    private ADBuySaleAllInfo adBuySaleAllInfo = new ADBuySaleAllInfo(null);


    @Override
    protected void initView() {
        super.initView();
        setContentView(R.layout.ac_buy_sale_all);

        SimpleHead simpleHead = ZViewHelp.findById(this,R.id.head);

        simpleHead.setTitle("进销存汇总");

        simpleHead.setOnItemclicklistener(this::finish);

        recyclerView = ZViewHelp.findById(this,R.id.recyclerView);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));

    }

    @Override
    protected void initViewModule() {
        super.initViewModule();

        vmBuySaleAll = new ViewModelProvider(this).get(VMBuySaleAll.class);


        vmBuySaleAll.getLiveGoodsInfo().observe(this,adBuySaleAllInfo::setList);

    }

    @Override
    protected void initData() {
        super.initData();
        recyclerView.setAdapter(adBuySaleAllInfo);
        vmBuySaleAll.requestGoodsInfo();
    }
}
